package com.gjintel.business.proj.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gjintel.business.proj.dao.IProfessorDao;
import com.gjintel.business.proj.model.BidderChange;
import com.gjintel.business.proj.model.ProfessorInfo;
import com.gjintel.business.proj.service.IProfessorService;
import com.gjintel.sdk.base.dao.Page;
import com.gjintel.sdk.base.service.impl.BaseServiceImpl;

@Service("professorService")
public class ProfessorServiceImpl extends BaseServiceImpl implements IProfessorService {
	
	@Autowired
	private IProfessorDao professorDao;	
	@Override
	@Transactional
	public void saveProfessorInfo(ProfessorInfo professorInfo) {
		this.saveOrUpdate(professorInfo);
	}


	@Override
	public List<ProfessorInfo> getProfessorInfo(String projectId,Page page) {
		return this.professorDao.getProfessorInfo(projectId,page);
	}


	@Override
	public ProfessorInfo getProfessorInfoById(String professorId) {
		return this.get(ProfessorInfo.class, professorId);
		
	}


	@Override
	public void deleteProfessorInfo(String professorInfo) {	
		String[] professorIds =professorInfo.split(",");
		for(int i = 0; i<professorIds.length;i++){	
			this.removeById(ProfessorInfo.class, professorIds[i]);
		}
		
	}


	@Override
	public List<ProfessorInfo> getProfessorList(String projectId) {
		return this.professorDao.getProfessorList(projectId);
	}


	@Override
	public List<ProfessorInfo> getProfessorInfoList(ProfessorInfo professorInfo, Page page) {
		return this.professorDao.getProfessorInfoList(professorInfo,page);
	}


	@Override
	public List<BidderChange> findBidderChanageList(String projectId) {
		return this.professorDao.findBidderChanageList(projectId);
	}

}
